<!--  -->
<template>
<div class="competition-item" @click="goodsTo(item)">
  <div class="item-img flex">
    <van-image
      radius="0.5rem"
      width="20.6875rem"
      height="auto"
      :src="item.thumb_link"
    />
    <div class="img-tag" v-if="item.activity_status == 2">报名中</div>
  </div>
  <div class="item-desc flex-a-c flex-j-sb">
    <div class="desc-warp">
      <h3>{{item.title}}</h3>
      <p>截止时间：{{item.end_time}}</p>
    </div>
    <div>
      <van-button round  color="#AAAAB3" style="width: 68px;height: 32px;font-size: 13px;" v-if="item.activity_status == 1">未开始</van-button>
      <van-button 
        round 
        type="info" 
        color="var(--themeBaseColor)" style="width: 68px;height: 32px;font-size: 13px;" v-if="item.activity_status == 2 && !item.is_full ">投稿</van-button>
      <van-button 
        round 
        type="info" 
        color="#AAAAB3" style="width: 68px;height: 32px;font-size: 13px;" v-if="item.activity_status == 2 && item.is_full ">活动已满</van-button>
      <van-button round  color="#AAAAB3" style="width: 68px;height: 32px;font-size: 13px;" v-if="item.activity_status == 3">已结束</van-button>
    </div>
  </div>
</div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import { Image as VanImage } from 'vant';
export default {
  props: {
    item: {
      type: Object,
      default:{}
    }
  },
  name:'',
  //import引入的组件需要注入到对象中才能使用
  components: {VanImage},
  data() {
  return {

  };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    goodsTo(item) {
      console.log(item)
      this.$router.push(this.fun.getUrl('applyDetails', {id:item.id}, {}));
    }
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {

  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {

  },
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入公共css类 */
@mixin competition-item {
  background: #FFFFFF;
  border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
  padding:0.625rem;
  margin:0 0 0.625rem 0;
}
.competition-item {
  @include competition-item;
  .item-img {
    position: relative;
    .img-tag {
      position: absolute;
      bottom:0;
      left:0;
      background: rgba(59, 179, 93, 0.8);
      border-radius: 0rem 0.5rem 0rem 0.5rem;
      font-weight: 400;
      font-size: 0.75rem;
      color: #FFFFFF;
      padding:0.25rem 0.375rem;
    }
  }
  .item-desc {
    .desc-warp {
      text-align: left;
      h3 {
        font-weight: 500;
        font-size: 0.875rem;
        color: #00001C;
        padding:0.6875rem 0 0.625rem 0;
      }
      p {
        font-weight: 400;
        font-size: 0.75rem;
        color: #999999;
      }
    }
  }
}
</style>